home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
newsgroups
/
misc.20021006-20030409
/
000119_mswarbrick@rentokil.com_Mon Dec 2 10:47:33 EST 2002.msg
< prev
next >
Wrap
Text File
|
2003-04-08
|
3KB
|
88 lines
Article: 13900 of comp.protocols.kermit.misc
Path: newsmaster.cc.columbia.edu!panix!newsfeed.media.kyoto-u.ac.jp!logbridge.uoregon.edu!newsfeed.stanford.edu!postnews1.google.com!not-for-mail
From: mswarbrick@rentokil.com (Mark Swarbrick)
Newsgroups: comp.protocols.kermit.misc
Subject: sms modem issues revisited
Date: 2 Dec 2002 07:40:26 -0800
Organization: http://groups.google.com/
Lines: 70
Message-ID: <e516d9ec.0212020740.396d532b@posting.google.com>
NNTP-Posting-Host: 213.2.66.194
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1038843626 5424 127.0.0.1 (2 Dec 2002 15:40:26 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: 2 Dec 2002 15:40:26 GMT
Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:13900
Hi guys..
I posted a while back asking for some help with communicating with an
sms modem via kermit. I haven't really refined the kermit scripts at
all since then. However I had to do another project based around
nagios (previously netsaint) for service monitoring.. I have written a
little hack to sms users when services go down using kermit. Though it
might be usual to someone (do let me know.) I suppose it might be
better in a nagios newsgroup but it's sorta a bit of both, so don't
flame me ok!?
In the nagios config file define the external handler to use
------
define command{
command_name sms_alert
command_line
/usr/local/nagios/libexec/event_handlers/sms_alert $SE\
RVICESTATE$ $STATETYPE$ $SERVICEATTEMPT$ $HOSTNAME$ $HOSTADDRESS$
$SERVICEDESC$\
$SERVICESTATE$ $DATE$ $TIME$
-----
Then create the event handler itself
#!/bin/sh
message(){
dir="/usr/local/nagios/libexec/event_handlers"
touch $dir/sms_message.msg
echo lineout AT+CMGS="+447747603208" >>$dir/sms_message.msg
echo input 20 >>$dir/sms_message.msg
echo lineout On $1 $2 the status of service $3 is $4 $5 $6
>>$dir/sms_message.msg
echo output \\26 >>$dir/sms_message.msg
echo input 20 ok >>$dir/sms_message.msg
mv $dir/sms_message.msg /tmp/outbox
}
# What state is the service in?
case "$1" in
OK)
;;
WARNING)
;;
CRITICAL)
if [ "$3" == "3" ] ;
then
message $4 $5 $6 $7 $8 $9 ;
fi
;;
UNKNOWN)
if [ "$3" == "3" ] ;
then
message $4 $5 $6 $7 $8 $9 ;
fi
;;
esac
exit 0
-------
This sms_message.msg can then be passed and processed via a kermit
kerbang script which just connects to the port and sends the message.
I couldn't find a simple solution to this, so I figured it might help
someone..